<template>
	<view>
		<u-sticky bgColor="#fff">
			<u-tabs :list="tabs" @click="tabClick" :activeStyle="activeStyle" lineColor="#675f91" :current="current">
			</u-tabs>
			<u-line></u-line>
		</u-sticky>
		<view class="blank30"></view>
		<view class="wrapper">
			功能开发中，请期待...
		</view>
		<view class="blank30"></view>
		
		
		<nodata v-if="loadingStatus == 'end' && list.length == 0"></nodata>
	</view>
</template>

<script>
	import nodata from '@/components/nodata.vue';
	import {
		dish_material_common_data,
		plan_week_model_overall_show
	} from '@/common/api.js';
	
	export default {
		components: {
			nodata
		},
		data() {
			return {
				current: 0,
				activeStyle: {
					color: '#675f91'
				},
				tabs: [{
						name: '周菜单'
					},
					{
						name: '日菜单'
					},
				],
				loadingStatus: '',
				list:[],
				list0:[],
				list1:[],
			}
		},
		methods: {
			tabClick(e) {
				this.current = e.index;
				this.list = this.current == 0 ? this.list0 : this.list1;
			},
			getData() {
					uni.showLoading({
						title: '加载中'
					});
					this.loadingStatus = 'loading';
					plan_week_model_overall_show().then((res) => {
						let {
							plan_week_model_overall_show
						} = res.result;
						let plan_week_model_overall_show_obj = {};
						let list0 = [];
						plan_week_model_overall_show.forEach((v, i) => {
							!plan_week_model_overall_show_obj[v.plan_week_manual_model] && (plan_week_model_overall_show_obj[v.plan_week_manual_model] = []);
							plan_week_model_overall_show_obj[v.plan_week_manual_model].push(v);
						})
						this.$store.commit('set_plan_week_model_overall_show', plan_week_model_overall_show_obj);	
						// this.list = this.current == 0 ? org_po_list : org_pr_list;
					}).catch(() => {
						uni.hideLoading();
					}).finally(() => {
						this.loadingStatus = 'end';
						uni.hideLoading();
						uni.stopPullDownRefresh();
					})
					
					dish_material_common_data().then((res) => {
						// let {
						// 	dinner_type_category,
						// 	dish_key,
						// 	dish_top_category,
						// 	number_category
						// } = res.result;
						// this.$store.commit('set_dinner_type_category', dinner_type_category);	
						// this.$store.commit('set_dish_key', dish_key);
						// this.$store.commit('set_dish_top_category', dish_top_category);
						// this.$store.commit('set_number_category', number_category);
						
					}).catch(() => {
						
					}).finally(() => {
						
					})
				}
		},
		onLoad() {
			console.log(this.$store.getters.get_days);
			
			this.getData();
		},
	}
</script>

<style>

</style>
